#ifndef TCPCLIENT_H
#define TCPCLIENT_H

#include <QObject>
#include<QTcpSocket>
#include<QString>
#include<queue>
#include<iostream>
using namespace  std;
class tcpclient : public QObject
{
    Q_OBJECT
public:
    explicit tcpclient(QString ip="192.168.229.128",int port=8080,QObject *parent = nullptr);
    //写请求数据
    //连接
    ~tcpclient();
    void TcpConnect();
    void send();  //发送数据
    void write(char*data);
    void write(const char*data);
    void write(QString str);
    void write(QByteArray arr);

    void clear();

    void clearnetwork();
    inline QByteArray getdata(){
        return arr;
    }
    inline QByteArray getnetworkdata(){
        return Receiving;
    }
    inline QTcpSocket* getsocket(){
        return m_socket;
    }
signals:
public:
    QTcpSocket *m_socket;
    QByteArray arr;
    QString m_ip;
    int m_port;
    //QTcpSocket *m_socket;
    QByteArray Receiving;  //接收缓冲区
};

#endif // TCPCLIENT_H
